home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / NumberDialog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  2.7 KB  |  57 lines  |  [TEXT/KAHL]

  1. /* NumberDialog.c */
  2. /*****************************************************************************/
  3. /*                                                                           */
  4. /*    Out Of Phase:  Digital Music Synthesis on General Purpose Computers    */
  5. /*    Copyright (C) 1994  Thomas R. Lawrence                                 */
  6. /*                                                                           */
  7. /*    This program is free software; you can redistribute it and/or modify   */
  8. /*    it under the terms of the GNU General Public License as published by   */
  9. /*    the Free Software Foundation; either version 2 of the License, or      */
  10. /*    (at your option) any later version.                                    */
  11. /*                                                                           */
  12. /*    This program is distributed in the hope that it will be useful,        */
  13. /*    but WITHOUT ANY WARRANTY; without even the implied warranty of         */
  14. /*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
  15. /*    GNU General Public License for more details.                           */
  16. /*                                                                           */
  17. /*    You should have received a copy of the GNU General Public License      */
  18. /*    along with this program; if not, write to the Free Software            */
  19. /*    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              */
  20. /*                                                                           */
  21. /*    Thomas R. Lawrence can be reached at tomlaw@world.std.com.             */
  22. /*                                                                           */
  23. /*****************************************************************************/
  24.  
  25. #include "MiscInfo.h"
  26. #include "Audit.h"
  27. #include "Debug.h"
  28. #include "Definitions.h"
  29.  
  30. #include "NumberDialog.h"
  31. #include "StringDialog.h"
  32. #include "Numbers.h"
  33. #include "Memory.h"
  34.  
  35.  
  36. /* present a dialog displaying InitialValue and asking for a new value.  the */
  37. /* new value is returned.  if the dialog couldn't be presented or the user cancelled, */
  38. /* then the original number is returned */
  39. long                    DoNumberDialog(char* Prompt, long InitialValue, struct MenuItemType* MCut,
  40.                                 struct MenuItemType* MPaste, struct MenuItemType* MCopy,
  41.                                 struct MenuItemType* MUndo, struct MenuItemType* MSelectAll,
  42.                                 struct MenuItemType* MClear)
  43.     {
  44.         char*                                String;
  45.  
  46.         String = IntegerToString(InitialValue);
  47.         if (String != NIL)
  48.             {
  49.                 if (DoStringDialog(Prompt,&String,MCut,MPaste,MCopy,MUndo,MSelectAll,MClear))
  50.                     {
  51.                         InitialValue = StringToInteger(String,PtrSize(String));
  52.                     }
  53.                 ReleasePtr(String);
  54.             }
  55.         return InitialValue;
  56.     }
  57.